package com.algorithm.base.greedy;

import java.util.Arrays;

/**
 * 455. 分发饼干
 *
 * @author Amadeus
 * @date 2023/11/16
 */
public class FindContentChildren {

    public int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);
        Arrays.sort(s);
        int i = 0;
        for (int j = 0; i < g.length && j < s.length; j++) {
            //满足胃口
            if (s[j] >= g[i]) {
                i++;
            }
        }
        return i;
    }

}
